#include <rtthread.h>
#include <rtdevice.h>
#include <dfs_fs.h>
#include <fal.h>

#define DBG_TAG "app.port_xpi_flash"
#define DBG_ENABLE 1
#define DBG_LVL DBG_LOG
#include <rtdbg.h>

int xpi_flash_init(void)
{
    fal_init();

    // fal_blk_device_create("flashdb");
    fal_mtd_nor_device_create("flashdb");

    /* 挂载文件系统 */
#ifdef BSP_USING_FATFS_ROOTFS    
    RT_ASSERT(dfs_mount("flashdb", "/xpi", "lfs", 0, 0) == 0);
    LOG_I("mount to '/xpi' success!");
#endif

    return 0;
}

INIT_APP_EXPORT(xpi_flash_init); 